class MyError(Exception):
    """自定义异常类"""
    def __init__(self, message):
        self.message = message
        super().__init__(message)

try:
    raise MyError("发生了我的错误")
except MyError as e:
    print(e.message)


